<?php
/**
 * @package scuttle
 * @file /admin/forms/BookmarksAdminFilterForm.class.php
 **/

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_MODULE_PATH . '/scuttle/class/AbstractFilterForm.class.php';
define('SC_SORT_KEY_BID', 1);
define('SC_SORT_KEY_UID', 2);
define('SC_SORT_KEY_BIP', 3);
define('SC_SORT_KEY_BSTATUS', 4);
define('SC_SORT_KEY_BDATETIME', 5);
define('SC_SORT_KEY_BMODIFIED', 6);
define('SC_SORT_KEY_BTITLE', 7);
define('SC_SORT_KEY_BADDRESS', 8);
define('SC_SORT_KEY_BDESCRIPTION', 9);
define('SC_SORT_KEY_DEFAULT', SC_SORT_KEY_BID);

class Scuttle_BookmarksFilterForm extends Scuttle_AbstractFilterForm
{
	var $mSortKeys = array(
		SC_SORT_KEY_BID => 'bId',
		SC_SORT_KEY_UID => 'uId',
		SC_SORT_KEY_BIP => 'bIp',
		SC_SORT_KEY_BSTATUS => 'bStatus',
		SC_SORT_KEY_BDATETIME => 'bDatetime',
		SC_SORT_KEY_BMODIFIED => 'bModified',
		SC_SORT_KEY_BTITLE => 'bTitle',
		SC_SORT_KEY_BADDRESS => 'bAddress',
		SC_SORT_KEY_BDESCRIPTION => 'bDescription',
	);
	function getDefaultSortKey()
	{
		return SC_SORT_KEY_DEFAULT;
	}

	function fetch()
	{
		parent::fetch();
		if (isset($_REQUEST['bId'])) {
			$this->mNavi->addExtra('bId', xoops_getrequest('bId'));
			$this->_mCriteria->add(new Criteria('bId', xoops_getrequest('bId')));
		}
		if (isset($_REQUEST['uId'])) {
			$this->mNavi->addExtra('uId', xoops_getrequest('uId'));
			$this->_mCriteria->add(new Criteria('uId', xoops_getrequest('uId')));
		}
		if (isset($_REQUEST['bIp'])) {
			$this->mNavi->addExtra('bIp', xoops_getrequest('bIp'));
			$this->_mCriteria->add(new Criteria('bIp', xoops_getrequest('bIp')));
		}
		if (isset($_REQUEST['bStatus'])) {
			$this->mNavi->addExtra('bStatus', xoops_getrequest('bStatus'));
			$this->_mCriteria->add(new Criteria('bStatus', xoops_getrequest('bStatus')));
		}
		if (isset($_REQUEST['bDatetime'])) {
			$this->mNavi->addExtra('bDatetime', xoops_getrequest('bDatetime'));
			$this->_mCriteria->add(new Criteria('bDatetime', xoops_getrequest('bDatetime')));
		}
		if (isset($_REQUEST['bModified'])) {
			$this->mNavi->addExtra('bModified', xoops_getrequest('bModified'));
			$this->_mCriteria->add(new Criteria('bModified', xoops_getrequest('bModified')));
		}
		if (isset($_REQUEST['bTitle'])) {
			$this->mNavi->addExtra('bTitle', xoops_getrequest('bTitle'));
			$this->_mCriteria->add(new Criteria('bTitle', xoops_getrequest('bTitle')));
		}
		if (isset($_REQUEST['bAddress'])) {
			$this->mNavi->addExtra('bAddress', xoops_getrequest('bAddress'));
			$this->_mCriteria->add(new Criteria('bAddress', xoops_getrequest('bAddress')));
		}
		if (isset($_REQUEST['bDescription'])) {
			$this->mNavi->addExtra('bDescription', xoops_getrequest('bDescription'));
			$this->_mCriteria->add(new Criteria('bDescription', xoops_getrequest('bDescription')));
		}

		$this->_mCriteria->addSort($this->getSort(), $this->getOrder());

	}
}

?>